package com.gec.component;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public abstract class HttpServletRequest {

	//URL: http://localhost:8080/Login [映射地址]
	//{1}表示资源的路径: /Login, /index.htm
	protected String resPath;
	//{2}表示 http 请求方式: GET,POST,其它..
	protected String method;
	//{3}存储客户提交的参数
	//   参数: usernanme=andy, password=123
	protected Map<String, String> paras = new HashMap();


	//-----------------[下面的方法不需要太关注]-----------------
	public String getMethod() {
		return this.method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public void setResPath(String resPath) {
		this.resPath = resPath;
	}

	public String getResPath() {
		return this.resPath;
	}

	public void prtParameters() {
		Set<String> keys = paras.keySet();
		int index = 0;
		for (String key : keys) {
			index++;
			String val = paras.get(key);
			System.out.printf("{%d}%s:%s\n",
					index, key, val);
		}
	}

	public abstract String getParameter(String name);

	public abstract Map<String, String> getParameters();

	public abstract void addParameter(String key, String val);

}